﻿using System;
using System.Text;
using ProjScan.Tools;
using UnityEditor;
using UnityEngine;

namespace ProjScan.RecordManager.AssetData
{
	// Token: 0x0200029E RID: 670
	internal class MeshGeometryAssetData : ImportAssetData<Mesh, ModelImporter>
	{
		// Token: 0x0600117C RID: 4476 RVA: 0x0000864D File Offset: 0x0000684D
		public MeshGeometryAssetData(int id, string path, Mesh mesh, ModelImporter modelImporter) : base(id, path, mesh, modelImporter)
		{
			this.Init(id, path, mesh, modelImporter);
		}

		// Token: 0x0600117D RID: 4477 RVA: 0x00008668 File Offset: 0x00006868
		public MeshGeometryAssetData(int id, string path, string fileNameWithoutExtension, Mesh mesh, ModelImporter modelImporter) : base(id, path, fileNameWithoutExtension, mesh, modelImporter)
		{
			this.Init(id, path, mesh, modelImporter);
		}

		// Token: 0x0600117E RID: 4478 RVA: 0x00052740 File Offset: 0x00050940
		private void Init(int id, string path, Mesh mesh, ModelImporter modelImporter)
		{
			bool flag = modelImporter == null;
			if (flag)
			{
				this.noImporter = true;
			}
			else
			{
				this.meshName = mesh.name;
				this.isReadable = modelImporter.isReadable;
				this.optimizeMesh = AssemblyTools.I.GetPropertyValue(modelImporter, "optimizeMesh");
				bool flag2 = this.optimizeMesh == null;
				if (flag2)
				{
					this.optimizeMeshPolygons = AssemblyTools.I.GetPropertyValue(modelImporter, "optimizeMeshPolygons");
					this.optimizeMeshVertices = AssemblyTools.I.GetPropertyValue(modelImporter, "optimizeMeshVertices");
				}
			}
			this.verticeCount = mesh.vertices.Length;
			this.uv2Count = mesh.uv2.Length;
			this.tangentsCount = mesh.tangents.Length;
			this.normalsCount = mesh.normals.Length;
			this.colorsCount = mesh.colors.Length;
			this.trianglesCount = mesh.triangles.Length / 3;
			this.uv3Count = mesh.uv3.Length;
			this.uv4Count = mesh.uv4.Length;
		}

		// Token: 0x0600117F RID: 4479 RVA: 0x00052848 File Offset: 0x00050A48
		public override string GetCSVHeader()
		{
			return "Name,DirID,Verts,Triangle";
		}

		// Token: 0x06001180 RID: 4480 RVA: 0x00052860 File Offset: 0x00050A60
		public override string GetInfo()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(ToolsHelper.QuoteString(this.fileName));
			stringBuilder.Append(',');
			stringBuilder.Append(this.assetPathId);
			stringBuilder.Append(',');
			stringBuilder.Append(this.verticeCount);
			stringBuilder.Append(',');
			stringBuilder.Append(this.trianglesCount);
			return stringBuilder.ToString();
		}

		// Token: 0x06001181 RID: 4481 RVA: 0x000528D4 File Offset: 0x00050AD4
		public override string GetAssetPath()
		{
			return string.IsNullOrEmpty(this.meshName) ? base.GetAssetPath() : (this.path + "$" + this.meshName);
		}

		// Token: 0x04000A34 RID: 2612
		public int verticeCount;

		// Token: 0x04000A35 RID: 2613
		public int uv2Count;

		// Token: 0x04000A36 RID: 2614
		public int tangentsCount;

		// Token: 0x04000A37 RID: 2615
		public int normalsCount;

		// Token: 0x04000A38 RID: 2616
		public int colorsCount;

		// Token: 0x04000A39 RID: 2617
		public int trianglesCount;

		// Token: 0x04000A3A RID: 2618
		public int uv3Count;

		// Token: 0x04000A3B RID: 2619
		public int uv4Count;

		// Token: 0x04000A3C RID: 2620
		public bool isReadable;

		// Token: 0x04000A3D RID: 2621
		public object optimizeMesh;

		// Token: 0x04000A3E RID: 2622
		public object optimizeMeshPolygons;

		// Token: 0x04000A3F RID: 2623
		public object optimizeMeshVertices;

		// Token: 0x04000A40 RID: 2624
		private string meshName;
	}
}
